package cc.aiee.zalopay.model;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import cc.aiee.zalopay.core.pojo.ZalopayBaseModel;
import cc.aiee.zalopay.core.tool.ZalopayTool;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = false)
public class ZalopayQueryRefundModel extends ZalopayBaseModel {

	/**
	 * <li>交易代码，由商家在查询退款交易时生成。</li>
	 * <li>格式：yymmdd_appid_xxxxxxxxxx</li>
	 */
	@NotBlank
	private String m_refund_id;

	/**
	 * 退款时间（unix时间戳，以毫秒为单位）。
	 */
	@NotNull
	private Long timestamp;

	public void setM_refund_id(String appId, String refund_id) {
		if (appId == null) {
			appId = super.getApp_id();
		}
		m_refund_id = ZalopayTool.getRefundId(appId, refund_id);
	}

}
